import 'package:flutter/material.dart';

class AnimationListPage extends StatefulWidget {

  @override
  _AnimationListPageState createState() => _AnimationListPageState();
}

class _AnimationListPageState extends State<AnimationListPage> with SingleTickerProviderStateMixin {
  @override
  AnimationController _animationController;
  Animation<double> _animation;

  @override
  initState(){
    _animationController = AnimationController(vsync: this, duration: Duration(milliseconds: 1000));
    _animation = Tween<double>(begin: 0,end: 1).animate(_animationController);
    super.initState();

    _animationController.forward();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    _animationController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement rebuild
    return Scaffold(
      appBar: AppBar(
        title: Text("AnimationList"),
        leading: IconButton(
          icon: Icon(Icons.arrow_back),
          onPressed: (){
            Navigator.of(context).pop();
          },
        ),
      ),
      body: Container(
        child: AnimatedList(
          initialItemCount: 10,
          itemBuilder: (context, index, animation){
            return ScaleTransition(
              scale: _animation,
              child: Container(
                padding: const EdgeInsets.all(20),
                child: Text("name$index"),
              ),
            );
          },
        ),
      ),
    );
  }
}